Move setting of ioready 'wait' earlier in call chain, to
[python/dscho.git] / Mac / IDE scripts / Widget demos / ActivateWindowDemo.py
blob3cd832b4d0f2fdc25b9d85c59ce0f5b7b579992b
1 import W
3 # this demoscript illustrates how to tie a callback to activating or clicking away of the window.
4 # evb 22 4 99
6 class ActivateDemo:
8 def __init__(self):
9 self.w = W.Window((200, 200), 'Activate demo')
10 self.w.bind("<activate>", self.my_activate_callback)
11 self.w.open()
13 def my_activate_callback(self, onoff):
14 '''the callback gets 1 parameter which indicates whether the window
15 has been activated (1) or clicked to the back (0)'''
16 if onoff == 1:
17 print "I'm in the front now!"
18 else:
19 print "I've been clicked away, Oh No!"
21 ad = ActivateDemo()